﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;


namespace DataCenter.ServiceBus
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
            ServiceBusInstaller.StartType = ServiceStartMode.Automatic;
            this.AfterInstall += new InstallEventHandler(ServiceInstaller_AfterInstall);
        }

        private void ServiceInstaller_AfterInstall(object sender, InstallEventArgs e)
        {
            using (ServiceController sc = new ServiceController(ServiceBusInstaller.ServiceName))
            {
                ServiceBusInstaller.StartType = ServiceStartMode.Automatic;
                sc.Start();
            }
        }
    }
}

